package com.gitee.ly.ymorm.session;

import com.gitee.ly.ymorm.YmOrmConfig;
import com.gitee.ly.ymorm.mapping.ParamMap;

import java.io.Closeable;
import java.sql.Connection;
import java.util.List;
import java.util.Map;

/**
 * SqlSession
 *
 * @author ly
 **/
public interface SqlSession extends Closeable {
    /**
     * close  session。
     */
    @Override
    void close();

    List<Map> selectList(String statementId, ParamMap paramMap);

    <E> List<E> selectList(String statementId, ParamMap paramMap, Class<? extends E> resultType);

    int insert(String statementId, ParamMap paramMap);

    int update(String statementId, ParamMap paramMap);

    int delete(String statementId, ParamMap paramMap);

    void commit();

    void commit(boolean force);

    void rollback();

    void rollback(boolean force);

    YmOrmConfig getConfiguration();

    Connection getConnection();
}
